package com.hunliji.monitor.share.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * File：MsgTypeEnum.java<br> Title: <br> Description: <br>
 *
 * @author lejin
 */
public enum MsgTypeEnum {

    TEXT("text", "文字"),
    POST("post", "富文本"),
    INTERACTIVE("interactive", "消息卡片"),
    ;

    private final String code;
    private final String msg;

    MsgTypeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static MsgTypeEnum getEnumByCode(String code) {
        return Stream.of(MsgTypeEnum.values()).filter(o -> Objects.equals(o.getCode(), code)).findAny().orElse(null);
    }
}
